package com.wangsb.entity;

import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.validator.constraints.Range;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.format.annotation.NumberFormat;

import javax.validation.constraints.Email;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.util.Date;

/**
 * @Description: TODO
 * @author: shenbing.wang@hand-china
 * @date: 2021年02月21日 10:54
 */
@Getter
@Setter
@ToString
public class User {
    @NotNull
    @Min(5)
    private Integer id;
    @NotEmpty
    private String userName;
    @Past(message = "请输入合法的时间")
    @DateTimeFormat(pattern = "yyyy/MM/dd")
    private Date birthday;
    private String[] hobbies;
    @Min(0)
    @NumberFormat(style = NumberFormat.Style.CURRENCY)
    private Double balance;
    @NumberFormat(style = NumberFormat.Style.PERCENT)
    private Double taskRate;
    @Range(min = 10000, max = 100000)
    @NumberFormat(pattern = "#,###.##")
    private Double salary;
    @NotEmpty
    @Pattern(regexp = "^1[3|4|5|7|8][0-9]{9}$", message = "请输入正确的手机号")
    private String phone;
    @Email
    private String email;
}
